/*
 * @Author: 260156 260156@gree.com.cn
 * @Date: 2022-08-08 13:52:35
 * @LastEditors: 260156 260156@gree.com.cn
 * @LastEditTime: 2022-08-15 16:44:49
 * @FilePath: \gree-zst-web\src\api\manage\model\manage.ts
 * @Description: 系统管理模块接口
 *
 * Copyright (c) 2022 by 260156 260156@gree.com.cn, All Rights Reserved.
 */

export type UserInfo = {
  id: number;
  empName: string;
  empNum: string;
  displayName: string;
} | null;

// 角色列表
export interface RoleListItem {
  createTime: null;
  id: number;
  menuIds: any[];
  menus: any[];
  remark: string;
  roleName: string;
  roleSign: "false" | "true";
  updateTime: string;
  updaterId: number;
  updaterName: string | null;
}

export interface GetRoleListParams {
  offset: number;
  limit: number;
  params: { roleName: string };
}

// 菜单树
export interface UserMenuTreeItem {
  id: number;
  text: string;
  hasChildren: boolean;
  children: UserMenuTreeItem[];
  attributes: {
    perms: string;
    url: string;
  };
  state: {
    selected: boolean;
  };
}

export interface UserMenuTreeParams {
  userId: number | null;
}

export interface GetUserMenuTree {
  children: UserMenuTreeItem[];
}

// 组织管理
export type OrganizationId = number;
export interface OrganizationList {
  id: OrganizationId;
  attributes: {
    name: string;
  };
  children: OrganizationList[];
}

// 用户管理
export interface GetUserListParams {
  deptId: OrganizationId;
  userName: string;
  pageNum: number;
  pageSize: number;
}

export interface UserListItem {
  id: number;
  empName: string;
  mailNum: string;
  empNum: string;
  deptId: OrganizationId;
  roleIds: number[];
  roleNameList: string[];
  updater: string;
  updateTime: string;
}

export interface GetLogListParams {
  currentPage: number;
  operationEndTime: string;
  operationStartTime: string;
  pageSize: number;
}

export interface LogListItem {
  id: number;
  createTime: string;
  username: string;
  userMailbox: string;
  operation: string;
  operationModule: string;
}
